package com.github.smartretry.spring4.registry.quartz;

import com.github.smartretry.core.RetryProcessor;
import org.quartz.Job;
import org.quartz.JobExecutionContext;

import java.util.List;

/**
 * @author yuni[mn960mn@163.com]
 */
public class RetryJob implements Job {

    private List<RetryProcessor> retryProcessorList;

    public RetryJob() {
    }

    public RetryJob(List<RetryProcessor> retryProcessorList) {
        this.retryProcessorList = retryProcessorList;
    }

    @Override
    public void execute(JobExecutionContext context) {
        retryProcessorList.forEach(RetryProcessor::doRetry);
    }
}
